﻿@using Presentation.Web.Admin
@model Application.Admin.Dto.TourDetailDto
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Ajax.BeginForm("addtourdetail", "tour", new AjaxOptions() { HttpMethod = "post", OnBegin = "checkedAddForm", OnSuccess = "addSuccess", OnFailure = "addFailure" }))
{
    <fieldset class="module width_full">
        @Html.Partial("_TourSightForm", Model)
    </fieldset>
    <p>
        @{
    if (Html.HasUiPermission(this.ViewContext, "addtourdetail"))
    {
            <input type="submit" value="添加" class='alt_btn module_margin' />
    } 
        }
    </p>
}
<script type="text/javascript">

    function checkedAddForm() {
        var res = true;
        if ($('#SightName').val() == "") {
            alert("线路景点名不能为空");
            $('#SightName').focus();
            res = false;
            return res;
        }
        return res;
    }

    function addSuccess(res) {
        if (res.success) {
            window.location.reload();
        }
        else {
            alert(res.message);
        }
    }

    function addFailure() {
        alert("添加失败了T_T！");
    }
</script>
